package com.ccys.cms.controller.userManagement;

import com.ccys.cms.service.userManagement.DoctorMessageTemplateService;
import com.ccys.common.vo.ResponseResult;
import com.ccys.db.dto.userManagement.DoctorMessageTemplateDto;
import com.ccys.db.vo.userManagement.DoctorMessageTemplatePageQueryVo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @program: WhiteCoat
 * @description: 医生快捷回复接口
 * @author: ZhangJingCan
 * @create: 2023-12-20 13:59
 **/

@RestController
@RequestMapping("userManagement")
@Api(tags = "userManagement-医生快捷回复接口")
public class DoctorMessageTemplateController {

    @Autowired
    private DoctorMessageTemplateService deleteDoctorMessageTemplate;


    @PostMapping("doctorMessageTemplate")
    @ApiOperation("保存医生快捷回复")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id/修改必传", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "name", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "groupId", value = "groupId", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "isDefault", value = "0:医生创建 ; 1:后台创建", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "doctorId", value = "医生ID/isDefault为0时，必须传", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "message", value = "消息内容", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "dispOrder", value = "序号", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult saveDoctorMessageTemplate(@ApiIgnore DoctorMessageTemplateDto dto) {
        return deleteDoctorMessageTemplate.saveDoctorMessageTemplate(dto);
    }

    @DeleteMapping("doctorMessageTemplate")
    @ApiOperation("根据ID删除医生快捷回复")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult deleteDoctorMessageTemplate(@ApiIgnore DoctorMessageTemplateDto dto) {
        return deleteDoctorMessageTemplate.deleteDoctorMessageTemplate(dto);
    }


    @GetMapping("doctorMessageTemplate")
    @ApiOperation("分页查询医生快捷回复")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "name模糊查询", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "groupId", value = "groupId/查询所有传null", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "0/1,查询所有传null", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "startDate", value = "开始日期,格式:yyyy-MM-dd", required = false, dataType = "date", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期,格式:yyyy-MM-dd", required = false, dataType = "date", paramType = "query"),
            @ApiImplicitParam(name = "orderByStr",
                    value = "(默认传：t1.created_on descend),(左到右依次:t1.name,t3.group_name,t1.message,t1.disp_order,t1.status,t2.user_fullname,t1.created_on)",
                    required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult<PageInfo<DoctorMessageTemplatePageQueryVo>, Object> findPageDoctorMessageTemplate(@ApiIgnore DoctorMessageTemplateDto dto) {
        return deleteDoctorMessageTemplate.findPageDoctorMessageTemplate(dto);
    }


    @PutMapping("doctorMessageTemplate/status")
    @ApiOperation("根据ID修改医生快捷回复状态")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态：0-禁用，1-启用", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult updateDoctorMessageTemplateStatus(@ApiIgnore DoctorMessageTemplateDto dto) {
        return deleteDoctorMessageTemplate.updateDoctorMessageTemplateStatus(dto);
    }

    @PutMapping("doctorMessageTemplate/dispOrder")
    @ApiOperation("根据ID修改排序")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "对象id", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "dispOrder", value = "序号，必须是整数", required = true, dataType = "string", paramType = "query"),
    })
    public ResponseResult updateDoctorMessageTemplateDispOrder(@ApiIgnore DoctorMessageTemplateDto dto) {
        return deleteDoctorMessageTemplate.updateDoctorMessageTemplateDispOrder(dto);
    }

}
